<?php
namespace wogu2\view\http;

use wogu2\mvc\Runtime;
use wogu2\view\ViewInterface;
use \Smarty as Engine;

class Smarty implements ViewInterface
{
    private $_engine = null;
    
    public function init($config) {
        include $config['classPath'];
        $this->_engine = new Engine();
        $this->_engine->setTemplateDir($config['templatesDir']);
        $this->_engine->setCompileDir($config['templatesCacheDir']);
    }
    
    public function assign($mix, $value = null) {
        $this->_engine->assign($mix, $value);
    }
    
    public function clear($key) {
        $this->_engine->clearAssign($key);
    }
    
    public function clearAll() {
        $this->_engine->clearAllAssign();
    }
    
    public function fetch($template) {
        return $this->_engine->fetch($template);
    }
}